<template>
	<view>
		<view class="banner">
			<swiper class="swiper" indicator-active-color="#8E70FD" :current="bannerindex" :autoplay="true" :interval="2000" :duration="500" circular  @change="bannercg">
				<block v-for="(banner,index) in bannerList" :key="index">
					<swiper-item>
						<image :src="banner.cover_image"></image>
					</swiper-item>
				</block>
			</swiper>
			<view class="banner-inter">
				<view class="banner-inter-item" :class="{'banner-inter-active': bannerindex == bindex}"  v-for="(banner,bindex) in bannerList" :key="bindex"></view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name:"bannerLoading",
		props:{
			bannerList:{
				type:Array,
				default() {
					return [];
				}
			},
			bannerindex:{
				type:[Number,String],
				default:0
			}
		},
		methods:{
			bannercg(e){
				this.$emit('bannercg',e.detail.current)
			}
		}
	}
</script>

<style lang="scss" scoped>
.banner{
	position: relative;
	
	.swiper{
		width: 750rpx;
		height: 100vh;
		
		image{
			@include img;
			// border-radius: 10rpx;
		}
	}
	
	&-inter{
		width: 100%;
		position: absolute;
		left: 0;
		bottom: 24rpx;
		z-index: 9;
		@include center;
		
		&-item{
			width: 10rpx;
			height: 10rpx;
			background: #FFFFFF;
			opacity: 0.5;
			border-radius: 50%;
			margin: 0 5rpx;
			transition: all 0.4s;
		}
		&-active{
			width: 30rpx;
			height: 10rpx;
			background: #E63C3C;
			border-radius: 5rpx;
			opacity: 1;
		}
	}
}
</style>
